package io.adrainty.bolee.security.feign.impl;

import io.adrainty.bolee.framework.commons.basic.ResultDTO;
import io.adrainty.bolee.framework.commons.utils.ResultDTOUtil;
import io.adrainty.bolee.security.feign.IClientFeign;
import io.adrainty.bolee.security.models.entity.ClientEntity;
import io.adrainty.bolee.security.service.IClientService;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author AdRainty
 * @version V1.0.0
 * @since 2025/8/9 下午7:24
 */

@Slf4j
@RestController
@Tag(name = "客户端接口")
@RequestMapping("/client-feign")
public class ClientFeignImpl implements IClientFeign {

    @Resource
    private IClientService clientService;

    @Override
    @GetMapping("/getClientList")
    public ResultDTO<List<ClientEntity>> getClientList() {
        List<ClientEntity> clientEntities = clientService.getClientList();
        return ResultDTOUtil.success(clientEntities);
    }

    @Override
    @GetMapping("/getClientEntity")
    public ResultDTO<ClientEntity> getClientEntity(@RequestParam("clientId") String clientId) {
        ClientEntity clientEntity = clientService.getClientEntity(clientId);
        return ResultDTOUtil.success(clientEntity);
    }

}
